﻿<%@ Page Title="" Language="C#" MasterPageFile="~/WarnMaster.Master" AutoEventWireup="true" CodeBehind="analysis.aspx.cs" Inherits="QunYing.Web.market.analysis" %>
<asp:Content ID="Content1" ContentPlaceHolderID="head" runat="server">
   <link href="style/cupertino/jquery.ui.all.css" rel="stylesheet" type="text/css" />

    <script src="js/jquery-ui-1.8.16.custom.min.js" type="text/javascript"></script>

    <script src="js/datepicker-en.js" type="text/javascript"></script>
    <script type="text/javascript">
        function setDate() {
            $("#<%=this.txtStartDate1.ClientID %>").datepicker({ dateFormat: "yy-mm-dd", changeMonth: true, changeYear: true });
            $("#<%=this.txtEndDate1.ClientID %>").datepicker({ dateFormat: "yy-mm-dd", changeMonth: true, changeYear: true });
            $("#<%=this.txtStartDate2.ClientID %>").datepicker({ dateFormat: "yy-mm-dd", changeMonth: true, changeYear: true });
            $("#<%=this.txtEndDate2.ClientID %>").datepicker({ dateFormat: "yy-mm-dd", changeMonth: true, changeYear: true });
        }
        $(function() {
            setDate();
        });

        function CheckDate1() {
            var startDate = $("#<%=this.txtStartDate1.ClientID %>").val();
            var endDate = $("#<%=this.txtEndDate1.ClientID %>").val();
            if (!CheckDate(startDate)) {
                alert("开始日期格式错误!");
                return false;
            }
            if (!CheckDate(endDate)) {
                alert("结束日期格式错误!");
                return false;
            }

            return isStartEndDate(startDate, endDate);
        }
        function CheckDate2() {
            var startDate = $("#<%=this.txtStartDate2.ClientID %>").val();
            var endDate = $("#<%=this.txtEndDate2.ClientID %>").val();
            if (!CheckDate(startDate)) {
                alert("开始日期格式错误!");
                return false;
            }
            if (!CheckDate(endDate)) {
                alert("结束日期格式错误!");
                return false;
            }

            return isStartEndDate(startDate, endDate);
        }
    </script>
    <style>
        #shopcart h2
        {
            background: url("images/cart_bg_05.gif") no-repeat scroll right top #AACDED;
            height: 28px;
            line-height: 28px;
        }
        #shopcart h2 strong
        {
            background: url("images/cart_bg_03.gif") no-repeat scroll left top transparent;
            display: block;
            height: 28px;
            padding: 0 20px;
        }
        .cart_table
        {
            -moz-border-bottom-colors: none;
            -moz-border-image: none;
            -moz-border-left-colors: none;
            -moz-border-right-colors: none;
            -moz-border-top-colors: none;
            border-color: #AACDED;
            border-style: solid;
            border-width: 0 3px;
            overflow: hidden;
            padding: 20px 17px 0;
        }
        .round
        {
            background: url("images/cart_bg_11.gif") repeat-x scroll 0 top transparent;
            height: 10px;
            margin-bottom: 10px;
        }
        .lround
        {
            background: url("images/cart_bg_09.gif") no-repeat scroll left top transparent;
            float: left;
            height: 10px;
            width: 10px;
        }
        .rround
        {
            background: url("images/cart_bg_10.gif") no-repeat scroll right top transparent;
            float: right;
            height: 10px;
            width: 10px;
        }
        th, td
        {
            border: 1px solid #AACDED;
            padding-left: 5px;
        }
        .navgo
        {
            text-align: right;
            margin: 10px 0px 10px 0px;
        }
table{margin: 2px;}
.search
{
    margin-top:10px;
    margin-bottom:10px;
    font-size:14px;
    margin-left:5px;
    }

    </style>
</asp:Content>
<asp:Content ID="Content2" ContentPlaceHolderID="ContentPlaceHolder1" runat="server">
    <asp:ScriptManager ID="ScriptManager1" runat="server">
    </asp:ScriptManager>
<div id="main">
      <div class="index_box" >
        <h2><span><strong>数据</strong>分析</span></h2>
       <div class="search">
                水族箱：<asp:DropDownList ID="ddlDevice" runat="server" Width="120px"></asp:DropDownList>
                开始时间：<asp:TextBox ID="txtStartDate1" runat="server" Width="80px"></asp:TextBox>
                结束时间：<asp:TextBox ID="txtEndDate1" runat="server" Width="80px"></asp:TextBox>
                <asp:DropDownList ID="ddlType" runat="server" Width="80px">
                        <asp:ListItem Text="温度" Value="水族箱温度值"></asp:ListItem>
                        <asp:ListItem Text="PH值" Value="水族箱PH值"></asp:ListItem>
                        <asp:ListItem Text="ORP值" Value="水族箱ORP值"></asp:ListItem>
                        <asp:ListItem Text="钙反应器PH值" Value="钙反应器PH值"></asp:ListItem>
                    </asp:DropDownList>
              
               <asp:Button ID="btnAnalysis" runat="server" Text="统计" OnClick="btnAnalysis_Click" OnClientClick="return CheckDate1();" /></li>
              
                </div>
          <asp:UpdatePanel ID="UpdatePanel1" runat="server" UpdateMode="Conditional">
         <ContentTemplate>
                 <asp:Chart ID="Chart1" runat="server" Height="150px" Width="600px" Palette="Pastel">
                        <Series>
                            <asp:Series Name="Series1" ChartType="Line" ChartArea="ChartArea1" Legend="Legend1">
                            </asp:Series>
                        </Series>
                        <ChartAreas>
                            <asp:ChartArea Name="ChartArea1">
                            </asp:ChartArea>
                        </ChartAreas>
                    </asp:Chart>
</ContentTemplate>
          </asp:UpdatePanel>
        </div>
        <div class="index_box">
        <h2><span><strong>历史</strong>报警</span></h2>
           <div class="search">
                    水族箱：<asp:DropDownList ID="ddlDevice2" runat="server" Width="150px">
                    </asp:DropDownList>
                    开始时间：<asp:TextBox ID="txtStartDate2" runat="server" Width="100px"></asp:TextBox>
                    结束时间：<asp:TextBox ID="txtEndDate2" runat="server" Width="100px"></asp:TextBox>
                    <asp:Button ID="btnQuery" runat="server" Text="查询" OnClick="btnQuery_Click" OnClientClick="return CheckDate2();" />
                </div>
                <asp:UpdatePanel ID="UpdatePanel2" runat="server" UpdateMode="Conditional">
         <ContentTemplate>
                <asp:GridView ID="GridView1" runat="server"  Width="658px" CellPadding="4" 
              ForeColor="#333333" GridLines="None" AutoGenerateColumns="False"
                        OnRowDataBound="GridView1_RowDataBound" DataKeyNames="序号,ICSA编号,告警时间" AllowPaging="True"
                        OnPageIndexChanging="GridView1_PageIndexChanging" PagerStyle-CssClass="cssPager"
                        PageSize="5">
                        <RowStyle CssClass="odd" />
                        <Columns>
                            <asp:BoundField DataField="序号" HeaderText="序号" SortExpression="序号">
                                <HeaderStyle Width="30px" />
                            <ItemStyle HorizontalAlign="Center" Width="50px" />
                            </asp:BoundField>
                            <asp:BoundField DataField="名称" HeaderText="水族箱" SortExpression="名称">
                            <HeaderStyle Width="100px" />
                            </asp:BoundField>
                            <asp:BoundField DataField="告警时间" HeaderText="告警时间" SortExpression="告警时间" 
                                DataFormatString="{0:yyyy-MM-dd HH:mm}">
                                <HeaderStyle Width="125px" />
                            <ItemStyle Width="130px" />
                            </asp:BoundField>
                            <asp:BoundField DataField="告警内容" HeaderText="告警内容" SortExpression="告警内容" />
                            <asp:BoundField DataField="告警状态" HeaderText="告警状态" SortExpression="告警状态">
                                <HeaderStyle Width="60px" />
                            <ItemStyle HorizontalAlign="Center" Width="60px" />
                            </asp:BoundField>
                            <asp:TemplateField HeaderText="详细信息">
                                <ItemTemplate>
                                    <asp:LinkButton ID="btnDetail" runat="server" Text="详细" OnClick="btnDetail_Click" CommandArgument='<%# Eval("序号")%>' />
                                </ItemTemplate>
                                <HeaderStyle Width="60px" />
                                <ItemStyle HorizontalAlign="Center" Width="60px" />
                            </asp:TemplateField>
                        </Columns>
                         <PagerStyle BackColor="#EBF4FB" HorizontalAlign="Right" CssClass="cssPager"  />
                <EmptyDataTemplate>
                    没有报警信息
                </EmptyDataTemplate>
                <SelectedRowStyle BackColor="#D1DDF1" Font-Bold="True" ForeColor="#333333" />
                <HeaderStyle BackColor="#EBF4FB" />
                <EditRowStyle BackColor="#2461BF" />
                <AlternatingRowStyle BackColor="White" />
                    </asp:GridView>
                    </ContentTemplate>
                    </asp:UpdatePanel>
        </div>
        </div>

</asp:Content>
